import React from 'react';
import './index.less';
import {bindAction, bindModel, render} from 'react-division';
import {Button, Space} from 'antd';
import HeaderAction from './actions/Header';

bindAction({
    headerA: HeaderAction
});

export default render({
    actions: ['headerA'],
    models: ['dmPageM']
})(class extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        const {action, dmPageM} = this.props;
        const {headerA} = action;
        const {turnInfoPage, turnListPage, saveProps} = headerA;
        
        return (
            <div className="design-model-page-header">
                <Space>
                    {dmPageM.page === 'list' && <Button
                        onClick={turnInfoPage}
                    >
                        新建数据模型
                    </Button>}
                    {dmPageM.page === 'detail' && [<Button
                        onClick={turnListPage}
                    >
                        返回
                    </Button>,
                    <Button
                        onClick={saveProps}
                        type="primary"
                    >
                        保存
                    </Button>]}
                </Space>
            </div>
        );
    }
});